Skip to content

✨ Support for Featherless.ai as inference provider. #1310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 24, 2025

Conversation

wxgeorge
Copy link
Contributor

Implements support for Featherless.ai as inference provider fully for chat and partially for completions (streaming completions to be covered in a future PR)

@julien-c julien-c added the inference-providers integration of a new or existing Inference Provider label Apr 2, 2025
@julien-c
Copy link
Member

julien-c commented Apr 2, 2025

Hi @wxgeorge we are currently finishing a refactoring of Inference Providers integration code in #1315, this should be merged soon, but we will need to rewrite part of your implementation (should be even simpler to integrate), will ping again after it's been merged.

@hanouticelina
Copy link
Contributor

Hi @wxgeorge,
We've merged a refactoring for Inference Provider integration into main, which should make adding new providers much easier. Could you merge main into your branch and update your PR accordingly? it should be relatively straightforward with the new structure:
1 - You have to update the PROVIDERS mapping here: inference/src/lib/getProviderHelper.ts#L49 and add featherless-ai (let's ensure we respect the alphabetical order) :

import * as FeatherlessAI from "../providers/featherless-ai";
...
export const PROVIDERS: Record<InferenceProvider, Partial<Record<InferenceTask, TaskProviderHelper>>> = {
	...
	"featherless-ai": {
		"conversational": new FeatherlessAI.FeatherlessAIConversationalTask(),
		"text-generation": new FeatherlessAI.FeatherlessAITextGenerationTask(),
	},
        ...

2 - Update packages/inference/src/providers/featherless-ai.ts to implement the two classes FeatherlessAIConversationalTask and FeatherlessAITextGenerationTask that inherit from BaseConversationalTask and BaseTextGenerationTask respectively:

import { BaseConversationalTask, BaseTextGenerationTask } from "./providerHelper";

const FEATHERLESS_API_BASE_URL = "https://api.featherless.ai";

export class FeatherlessAIConversationalTask extends BaseConversationalTask {
	constructor() {
		super("featherless-ai", FEATHERLESS_API_BASE_URL);
	}
}

export class FeatherlessAITextGenerationTask extends BaseTextGenerationTask {
	constructor() {
		super("featherless-ai", FEATHERLESS_API_BASE_URL);
	}
}

and that's it :) let us know if you need any help! you can find more details in the documentation here : https://huggingface.co/docs/inference-providers/register-as-a-provider#2-js-client-integration

@julien-c
Copy link
Member

julien-c commented Apr 8, 2025

(sorry for the moving parts @wxgeorge – we can help move this PR over the finish line if needed)

@wxgeorge wxgeorge force-pushed the provider-featherless-ai branch from 40c84bd to 85cc8c0 Compare April 10, 2025 21:04
@wxgeorge
Copy link
Contributor Author

(sorry for the moving parts @wxgeorge – we can help move this PR over the finish line if needed)

all good @julien-c

@julien-c @hanouticelina - updated!

Copy link
Contributor

@SBrandeis SBrandeis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there,
Thank you for your contribution!
I have left a few minor comments to be addressed before we can proceed with this PR.
Can you also update the README.md and add the relevant informations about Featherless there, please?


Additionally, before merging, you need to run the tests in cache mode to update the tapes.json file.

You can do so by running the following command in your terminal:

VCR_MODE=cache pnpm run test -t "Featherless"

You'll a HF_FEATHERLESS_KEY set in your environment

@wxgeorge wxgeorge force-pushed the provider-featherless-ai branch from 0b59d13 to 5e48368 Compare April 15, 2025 17:29
@wxgeorge
Copy link
Contributor Author

@SBrandeis - thanks for the feedback. I think I've covered them all!

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Contributor

@hanouticelina hanouticelina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! thank you @wxgeorge

@hanouticelina hanouticelina merged commit 33801ba into huggingface:main Apr 24, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inference-providers integration of a new or existing Inference Provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants